useFixture(default)

def test():
	from Modules import commonBits
	java_recorded_version = '1.5.0_11'

	if window('Protocol Buffer Editor'):
		select('FileChooser', commonBits.sampleDir() + 'protoSales.bin')
		click('Edit1')
		select_menu('View>>Sorted Field Tree')
		##select('List', 'sale')
		select('Table', 'store', 'Field,0')
		##select('Table', 'department', 'Field,1')
		select('Table', 'department', 'Field,1')
		select('Table', 'cell:Field,1(department)')
		click('Build Tree')
		select('JTreeTable', 'cell:keycode,1(null)')
		rightclick('JTreeTable', 'keycode,1')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:Tree,4(null)')
		rightclick('JTreeTable', 'keycode,4')
		select_menu('Copy Record#{s#}')
		select('JTreeTable', 'cell:keycode,6(null)')
		rightclick('JTreeTable', 'keycode,6')
		select_menu('Paste Record#{s#}')
		select('JTreeTable', 'rows:[6,7,8],columns:[keycode]')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'rows:[6,7,8],columns:[keycode]')
		select('Table', 'cell:1|keycode,1(60694698)')
		assert_p('Table', 'Text', '64614401', '1|keycode,3')
		select('Table', 'cell:1|keycode,2(60664659)')
		assert_p('Table', 'RowCount', '7')
		select('Table', 'cell:1|keycode,3(64614401)')
		assert_p('Table', 'Content', '[[67674686, 59, 929, 40118, 1, 3990], [60694698, 59, 620, 40118, 1, 3990], [60664659, 59, 620, 40118, 1, 3990], [64614401, 59, 957, 40118, 1, 1990], [64614401, 59, 957, 40118, 1, 1990], [62684217, 59, 957, 40118, 1, 9990], [64624770, 59, 957, 40118, 1, 2590]]')
		select('Table', 'cell:1|keycode,3(64614401)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'cell:Tree,7(null)')
		rightclick('JTreeTable', 'Tree,7')
		select_menu('Delete Record#{s#}')
		select('JTreeTable', 'cell:Tree,6(null)')
		assert_p('JTreeTable', 'RowCount', '10')
		select('JTreeTable', 'rows:[6,7],columns:[keycode]')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'rows:[6,7],columns:[keycode]')
		select('Table', 'cell:1|keycode,0(67674686)')
		assert_p('Table', 'Text', '64614401', '1|keycode,1')
		select('Table', 'cell:1|keycode,4(64624770)')
		assert_p('Table', 'Text', '64624770', '1|keycode,4')
		select('Table', 'cell:1|keycode,3(62684217)')
		assert_p('Table', 'RowCount', '5')
		select('Table', 'cell:1|keycode,1(64614401)')
		assert_p('Table', 'Content', '[[67674686, 59, 929, 40118, 1, 3990], [64614401, 59, 957, 40118, 1, 1990], [64614401, 59, 957, 40118, 1, 1990], [62684217, 59, 957, 40118, 1, 9990], [64624770, 59, 957, 40118, 1, 2590]]')
		select('Table', 'cell:1|keycode,1(64614401)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'cell:Tree,6(null)')
		rightclick('JTreeTable', 'keycode,6')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,8(null)')
		rightclick('JTreeTable', 'keycode,8')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,10(64614401)')
		assert_p('JTreeTable', 'Text', '59', 'store,11')
		select('JTreeTable', 'cell:keycode,11(62684217)')
		assert_p('JTreeTable', 'RowCount', '15')
		select('JTreeTable', 'cell:keycode,9(64614401)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 67674686, 59, 929, 40118, 1, 3990], [, , , , , , , ], [, , 64614401, 59, 957, 40118, 1, 1990], [, , 64614401, 59, 957, 40118, 1, 1990], [, , 62684217, 59, 957, 40118, 1, 9990], [, , 64624770, 59, 957, 40118, 1, 2590], [, , , , , , , ], [, , , , , , , ]]')
		select('JTreeTable', 'cell:keycode,6(null)')
		rightclick('JTreeTable', 'keycode,6')
		select_menu('Collapse Tree')
		select('JTreeTable', 'rows:[9,10],columns:[keycode]')
		rightclick('JTreeTable', 'keycode,9')
		select_menu('Delete Record#{s#}')
		select('JTreeTable', 'cell:keycode,8(64614401)')
		assert_p('JTreeTable', 'RowCount', '12')
		select('JTreeTable', 'cell:keycode,9(64624770)')
		assert_p('JTreeTable', 'Text', '', 'keycode,10')
		select('JTreeTable', 'cell:keycode,8(64614401)')
		assert_p('JTreeTable', 'Content', '[[, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , , , , , , ], [, , 64614401, 59, 957, 40118, 1, 1990], [, , 64624770, 59, 957, 40118, 1, 2590], [, , , , , , , ], [, , , , , , , ]]')
		select('JTreeTable', 'cell:keycode,3(null)')
		rightclick('JTreeTable', 'keycode,3')
		select_menu('Delete Record#{s#}')
		select('JTreeTable', 'rows:[2,3],columns:[keycode]')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'rows:[2,3],columns:[keycode]')
		select('Table', 'cell:1|keycode,0(61664713)')
		assert_p('Table', 'Content', '[[61664713, 59, 335, 40118, 1, 17990], [61664713, 59, 335, 40118, -1, -17990], [61684613, 59, 335, 40118, 1, 12990], [60694698, 59, 620, 40118, 1, 3990], [60664659, 59, 620, 40118, 1, 3990]]')
		select('Table', 'cell:1|keycode,1(61664713)')
		assert_p('Table', 'RowCount', '5')
		select('Table', 'cell:1|keycode,4(60664659)')
		select('Table', 'cell:1|keycode,3(60694698)')
		assert_p('Table', 'Text', '60694698', '1|keycode,3')
		select('Table', 'cell:1|keycode,3(60694698)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'cell:keycode,0(null)')
		rightclick('JTreeTable', 'keycode,0')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,7(null)')
		rightclick('JTreeTable', 'keycode,7')
		select_menu('Delete Record#{s#}')
		select('JTreeTable', 'cell:keycode,6(null)')
		assert_p('JTreeTable', 'RowCount', '13')
		select('JTreeTable', 'rows:[5,6,7],columns:[keycode]')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'rows:[5,6,7],columns:[keycode]')
		select('Table', 'cell:1|keycode,0(64634429)')
		assert_p('Table', 'Text', '66624458', '1|keycode,1')
		select('Table', 'cell:1|keycode,4(60664659)')
		assert_p('Table', 'Text', '60664659', '1|keycode,4')
		select('Table', 'cell:1|keycode,3(60694698)')
		assert_p('Table', 'Content', '[[64634429, 20, 957, 40118, 1, 3990], [66624458, 20, 957, 40118, 1, 890], [63674861, 20, 957, 40118, 10, 2700], [60694698, 59, 620, 40118, 1, 3990], [60664659, 59, 620, 40118, 1, 3990]]')

		select('Table', 'cell:1|keycode,2(63674861)')
		assert_p('Table', 'RowCount', '5')
		select('Table', 'cell:1|keycode,2(63674861)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('JTreeTable', 'cell:keycode,11(null)')
		rightclick('JTreeTable', 'keycode,11')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,10(null)')
		rightclick('JTreeTable', 'keycode,10')
		select_menu('Delete Record#{s#}')
		select('JTreeTable', 'cell:keycode,1(null)')
		rightclick('JTreeTable', 'keycode,1')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,5(null)')
		rightclick('JTreeTable', 'keycode,5')
		select_menu('Expand Tree')
		select('JTreeTable', 'cell:keycode,4(null)')
		assert_p('JTreeTable', 'RowCount', '55')
		select('JTreeTable', 'rows:[4,5,6],columns:[keycode]')
		select_menu('View>>Table View #{Selected Records#}')
		select('JTreeTable', 'rows:[4,5,6],columns:[keycode]')
		select('Table', 'cell:1|keycode,0(67674686)')
		assert_p('Table', 'Text', '67674686', '1|keycode,0')
		select('Table', 'cell:1|keycode,5(60614707)')
		assert_p('Table', 'Text', '60614707', '1|keycode,5')
		select('Table', 'cell:1|keycode,4(68654655)')
		assert_p('Table', 'Content', '[[67674686, 59, 929, 40118, 1, 3990], [60614646, 166, 60, 40118, 1, 6000], [69654084, 166, 60, 40118, 1, 6000], [69644897, 166, 60, 40118, 1, 5080], [68654655, 166, 60, 40118, 1, 5080], [60614707, 166, 60, 40118, 1, 6000]]')

		select('Table', 'cell:1|keycode,2(69654084)')
		assert_p('Table', 'RowCount', '6')
		select('Table', 'cell:1|keycode,2(69654084)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		click('BasicInternalFrameTitlePane$NoFocusButton2')
		select('Table', 'cell:1|keycode,4(69694158)')
		assert_p('Table', 'RowCount', '371')
		select('Table', 'cell:1|keycode,4(69694158)')
		click('BasicInternalFrameTitlePane$NoFocusButton2')

		if window('Save Changes to file: ' + commonBits.sampleDir() + 'protoSales.bin'):
			click('No')
		close()
	close()
